// GetPropertyFunction.h: interface for the GetPropertyFunction class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GETPROPERTYFUNCTION_H__DC63ACCF_FE3F_496A_A266_15B227032303__INCLUDED_)
#define AFX_GETPROPERTYFUNCTION_H__DC63ACCF_FE3F_496A_A266_15B227032303__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "FunctionObject.h"
#include "Variable.h"
#include "afxtempl.h"
#include "DataSet.h"

class DllExport GetPropertyFunction : public FunctionObject, protected PropertyDataSet
{
	DECLARE_DYNAMIC_CREATE(GetPropertyFunction);

public:
	GetPropertyFunction();
	virtual ~GetPropertyFunction();

public:
	void AddCondition(Variable* pVar){
		ASSERT(pVar);
		m_Condition.Add(pVar);
	}

	void AddTable(const CString& strTable){
		ASSERT(!strTable.IsEmpty());
		m_theTables.Add(strTable);
	}

	void Regular(const CString& strSql){
		ASSERT(!strSql.IsEmpty());
		m_strSql = strSql;
	}

	void Prior(INT nPrior){
		m_nPrior = nPrior;
	}

	INT Prior() const {
		return m_nPrior;
	}

public:
	virtual BOOL Execute(){
		return GetProperties();
	}

	BOOL GetProperties();
	BOOL IsFill();
	void ResetCondition();

private:
	void SetConditionKnown();
	CString GetSql();

private:
	CArray<Variable*, Variable*> m_Condition;
	CString m_strSql;
	INT m_nPrior;
};

#endif // !defined(AFX_GETPROPERTYFUNCTION_H__DC63ACCF_FE3F_496A_A266_15B227032303__INCLUDED_)
